﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using UniversityStudentManagemnetSystem.BLL;

namespace UniversityStudentManagemnetSystem.UI
{
    public partial class Reset : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {


        }

        protected void resetButton_Click(object sender, EventArgs e)
        {
            ClientScriptManager CSM = Page.ClientScript;
            if (!ReturnValue())
            {
                string strconfirm = "<script>if(!window.confirm('Are you sure?')){window.location.href='Reset.aspx'}</script>";
                CSM.RegisterClientScriptBlock(this.GetType(), "Confirm", strconfirm, false);
            }
            try
            {
                ResetManager manager=new ResetManager();
                string message=  manager.ResetCourses();
                messageLabel.ForeColor = Color.BlueViolet;
                messageLabel.Text = message;

            }
                catch(FormatException exception)
                {
                    messageLabel.ForeColor = Color.Red;
                    messageLabel.Text = exception.Message;
                }
            catch (Exception exception)
            {
                messageLabel.ForeColor = Color.Red;
                messageLabel.Text=exception.Message;
            }
          
        }

        private bool ReturnValue()
        {
            return false;
        }
    }
}